<?php
namespace app\admin\model;
use think\Request;
use think\Db;
use think\Model;
use think\Session;
class Admin extends Model
{
    /*
     *日志操作
     *@return bools
     */ 
    public function log($admin_id,$operation) {
        $request = Request::instance();
        $data = [
            'operation' => $operation,
            'admin_id'  => $admin_id,
            'time'      => time(),
            'ip'        => $request->ip()
        ];
        Db::name('log')->insert($data);
    }
    /*返回当前管理员信息
     *@return mixed
     *
     */
    public function  adminInfo() {
        return Db::name('admin')->where('id',Session::get('admin_id'))->find();
    }

}
